<?php
/**
 * The loop that displays a single post.
 *
 * The loop displays the posts and the post content.  See
 * http://codex.wordpress.org/The_Loop to understand it and
 * http://codex.wordpress.org/Template_Tags to understand
 * the tags used in it.
 *
 * This can be overridden in child themes with loop-single.php.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.2
 */
?>

<?php if (have_posts()) :?><h1>This is Rented Books List</h1> <br />	<?php
	library_pages_links();
    ?><br />
<table border="5" cellpadding="5" cellspacing="15" width="99%" cols="6" id="booklist" class="booklist">
<tr border="1" id="booklist" class="booklist"><th><h3>Book ID:</h3></th><th width="300px" style="width:400px;"><h3>Title:</h3></th><th><h3>Authors</h3></th><th><h3>Category/Class</h3></th><th><h3>Publishers</h3></th><th><h3>Availablity</h3></th><th><h3>Borrower</h3></th></tr>

<?php while (have_posts()) : the_post(); 		
		$custom = get_post_custom($post->ID);
		$bookdate = $custom['bookdate'][0];
		$bookid= $custom['bookid'][0];
		$authors= $custom['bookauthors'][0]; 
		$price= $custom['price'][0];
		$receive_date= $custom['receive_date'][0];
		$receive_from= $custom['from'][0]; 	
		$availablity= $custom['wpbl_availablity'][0];
		$borrower= $custom['wpbl_user'][0];	
		?>

<tr><td><a href="<?php the_permalink() ?>" title="<?php printf(__("Permanent Link to %s", "wpbl"), the_title_attribute('echo=0')); ?>"><?php echo $bookid; ?></a></td>
<td style="width:400px;"><a href="<?php the_permalink() ?>" title="<?php printf(__("Permanent Link to %s", "wpbl"), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></td>

<td>
<?php the_terms( $post->ID, 'authors'); ?></td>
<td><?php the_terms( $post->ID, 'classcat'); ?></td>
<td><?php the_terms( $post->ID, 'publishers'); ?></td>				
<td class="<?php echo $availablity; ?>"><?php echo $availablity; ?></td>
<td><?php echo $borrower; ?></td>
</tr>
 
<?php endwhile; ?></table><br /><?php else: ?>
		<div id="container">
			<div id="content" role="main">
				<div id="post-0" class="post no-results not-found">
					<h2 class="entry-title"><?php _e( 'Nothing Found', 'twentyten' ); ?></h2>
					<div class="entry-content">
					<p><?php _e('Sorry, Nobody is using any book from your library','wpbl'); ?></p>
						<?php if(function_exists('wp_custom_fields_search')) {
	wp_custom_fields_search(); }else{
	get_search_form(); } ?>

					</div><!-- .entry-content -->
				</div><!-- #post-0 -->
					</div><!-- #content -->
		</div><!-- #container -->	
<?php get_sidebar(); ?>

<?php endif; ?>
